From: Carlos Garnacho Date: Tue, 17 Jan 2023 17:40:10 +0000 (+0100) Subject: Revert "windowMenu: Do actions requiring grab once ungrabbed" X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~405^2^2~144 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ac42eb62f83363f30692f0c1b797349c505e33df;p=gnome-shell.git Revert "windowMenu: Do actions requiring grab once ungrabbed" This reverts commit 2b3ab3ececd2b70023547552b1acf84cbc4fecb1. Since the window menu no longer uses a MetaDisplay grab, but directly a ClutterGrab, this is ineffective. But also, grabs are stackable, so it's fine to push the window operation grab first and then dismiss the window menu grab, even when MetaDisplay grabs get ported to using ClutterGrab underneath. We now can just grab right away, so do that. Part-of: --- diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js index 081645f04..c5a632803 100644 --- a/js/ui/windowMenu.js +++ b/js/ui/windowMenu.js @@ -1,7 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -* /* exported WindowMenuManager */ -const { GLib, Meta, St } = imports.gi; +const {Meta, St} = imports.gi; const BoxPointer = imports.ui.boxpointer; const Main = imports.ui.main; @@ -57,13 +57,13 @@ var WindowMenu = class extends PopupMenu.PopupMenu { item.setSensitive(false); item = this.addAction(_("Move"), event => { - this._grabAction(window, Meta.GrabOp.KEYBOARD_MOVING, event.get_time()); + window.begin_grab_op(Meta.GrabOp.KEYBOARD_MOVING, true, event.get_time()); }); if (!window.allows_move()) item.setSensitive(false); item = this.addAction(_("Resize"), event => { - this._grabAction(window, Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, event.get_time()); + window.begin_grab_op(Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, true, event.get_time()); }); if (!window.allows_resize()) item.setSensitive(false); @@ -184,26 +184,6 @@ var WindowMenu = class extends PopupMenu.PopupMenu { if (!window.can_close()) item.setSensitive(false); } - - _grabAction(window, grabOp, time) { - if (global.display.get_grab_op() == Meta.GrabOp.NONE) { - window.begin_grab_op(grabOp, true, time); - return; - } - - let waitId = 0; - let id = global.display.connect('grab-op-end', display => { - display.disconnect(id); - GLib.source_remove(waitId); - - window.begin_grab_op(grabOp, true, time); - }); - - waitId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, () => { - global.display.disconnect(id); - return GLib.SOURCE_REMOVE; - }); - } }; var WindowMenuManager = class {